CDS 6334 - Visual Image Processing

Lecture 3: Image Filtering

1. What is Image Filtering?

Image Filtering is a neighbourhood-based processing technique where a pixel is modified using information from surrounding pixels.
Unlike point-based processing, filtering uses neighbouring pixels to determine the new value.
๐Ÿง  Memory Trick:

Point Processing = Pixel โ†’ Pixel
Filtering = Neighbourhood โ†’ Pixel

2. Why Do We Use Filtering?

Exam Keyword:
Neighbourhood Processing

3. Common Types of Noise

Noise Type Description
Salt & Pepper Noise Random black and white pixels
Impulse Noise Random bright pixels
Gaussian Noise Intensity variations following a normal distribution
๐Ÿง  Remember:
Salt & Pepper = Isolated extreme pixels
Gaussian = Continuous random variation

4. Neighbourhood Processing

Modify a pixel using surrounding pixels within a small window (mask/filter).
Example:
A 3ร—3 filter uses 9 pixels to compute one output pixel.
The filter slides across the entire image.

5. Moving Average Filter

Replace each pixel with the average of neighbouring pixels.
Example Kernel:

[1 1 1]
[1 1 1] รท 9
[1 1 1]
Produces smoothing and noise reduction.
Exam Keyword:
Averaging Filter / Box Filter

6. Weighted Moving Average

Nearby pixels contribute more than distant pixels.
Example:
[1 4 6 4 1] รท 16
๐Ÿง  Remember:
Not all neighbours are equally important.

7. Correlation Filtering

Apply the filter directly on the image without changing the kernel orientation.
Each filter value acts as a weight for its corresponding neighbour.
๐Ÿง  Shortcut:
Correlation = Direct Application

8. Boundary Problem

Filters extend beyond image borders near edges.
Padding Method Description
Zero Padding Fill outside area with 0
Wrap Around Use pixels from opposite side
Copy Edge Repeat border pixels

9. Gaussian Filter

A weighted smoothing filter where centre pixels receive larger weights.
Produces smoother results while preserving more details than a simple average filter.
Important Parameter:
ฯƒ (Sigma)
๐Ÿง  Sigma Rule:
Larger ฯƒ โ†’ More Blur
Smaller ฯƒ โ†’ Less Blur

10. Properties of Smoothing Filters

Smoothing reduces noise but may remove fine details.

11. Convolution

Convolution flips the kernel horizontally and vertically before filtering.
Steps:
  1. Flip kernel
  2. Apply correlation process
  3. Store result
๐Ÿง  Memory Trick:
Convolution = Flip + Correlation

12. Correlation vs Convolution

Correlation Convolution
Kernel not flipped Kernel flipped
Direct filtering Flip then filter
Easier to understand Important in signal processing
Special Rule:
Symmetric Kernel โ‡’ Correlation = Convolution

13. Filter Separability

Some filters can be split into horizontal and vertical operations.
Reduces computational cost significantly.
๐Ÿง  Exam Point:
Gaussian Filter is separable.

14. Image Sharpening

Sharpening enhances edges and local intensity differences.
Opposite goal of smoothing.
๐Ÿง  Remember:
Smoothing removes details.
Sharpening restores details.

15. Unsharp Masking

One of the most common sharpening techniques.
Step Formula
Extract Details Original โˆ’ Smoothed
Sharpen Image Original + Details
Exam Formula:
Details = Original โˆ’ Smoothed
Sharpened = Original + Details

16. Median Filter

Replaces a pixel with the median value of neighbouring pixels.
Removes outliers without introducing new pixel values.
Best For:
Salt & Pepper Noise
๐Ÿง  Median ignores extreme values naturally.

17. Multi-Stage Median Filter

Combines multiple median filters from different neighbourhoods.
Preserves corners and important image structures better than a standard median filter.

18. Alpha-Trimmed Mean Filter

Hybrid filter between averaging and median filtering.
Procedure:
  1. Sort neighbourhood values
  2. Remove ฮฑ/2 smallest values
  3. Remove ฮฑ/2 largest values
  4. Average remaining values
Reduces effect of extreme outliers while still using averaging.
๐Ÿง  Think:
Average + Median = Alpha-Trimmed Mean

19. Filter Comparison

Filter Strength Weakness
Average Filter Simple smoothing Blurry output
Gaussian Filter Better smoothing Still causes blur
Median Filter Excellent for impulse noise May remove fine details
Alpha-Trimmed Mean Balances averaging and median Requires parameter tuning

20. Final Exam Summary

Most Important Points

  • Filtering: Uses neighbouring pixels.
  • Moving Average: Average of neighbours.
  • Gaussian Filter: Weighted smoothing using ฯƒ.
  • Correlation: Apply kernel directly.
  • Convolution: Flip kernel first.
  • Special Rule: Symmetric kernel โ†’ Correlation = Convolution.
  • Separability: Gaussian filter is separable.
  • Sharpening: Enhance edges and details.
  • Unsharp Masking: Original + (Original โˆ’ Smoothed).
  • Median Filter: Best for Salt & Pepper Noise.
  • Alpha-Trimmed Mean: Remove extremes then average.